Video-encoding device and video-encoding control method

ABSTRACT

A video-encoding device that can achieve seamless connection without causing an error in a VBV buffer is provided. Recording-mode determination means for determining an initial value of the occupied amount of a virtual buffer based on a determination result relating to seamless connection between a preceding chapter and the following chapter that are included in video signals, occupied-amount update means for updating the occupied amount of the virtual buffer, optimum-occupied-amount calculation means for calculating a predetermined optimum occupied amount based on the updated occupied amount of the virtual buffer, target-code-amount calculation means for calculating a predetermined target-code amount based on the video signals of the following chapter, target-code-amount adjustment means for adjusting the target code amount so that the sum total of the occupied amount of the virtual buffer and the target code amount does not exceed the optimum occupied amount, and encoding means for performing the encoding according to the adjusted target code amount are provided.

TECHNICAL FIELD

The present invention relates to a video-encoding device for encoding avideo signal and particularly relates to a video-encoding device thatcontrols the amount of codes generated from a following chapter, whereseamless connection between chapters is performed, a video-encodingcontrol device, and a video-encoding control method and a program formaking a computer execute the method.

BACKGROUND ART

In recent years, optical disks have received attention, as recordingmediums that can store video data and audio data. The optical disk isused, not only as a medium used for a contents commodity such as amovie, but also as a writable medium used for recording data on the userside. For example, the DVD standard that allows onetime recording ofdata onto one and the same area, the DVD-RW standard that allowsrewriting data repetitively, and so forth are known, as the rewritablemedium. The DVD-Video standard used for a reproduce-only disk is known,as the file format of the above-described optical mediums. However, datacan be written onto the writable medium in keeping with the DVD-Videostandard.

The DVD-Video standard allows recording to a maximum of ninety ninetitles per disk. Further, each of the titles can include to a maximum ofninety-nine chapters (PTT: Part of Title). In the case where data isrecorded onto the above-described DVD-R and DVD-RW through a camcorder:camera and recorder, a single recording unit from the start of recordingto the end of recording is recorded, as a chapter. Further, the singlerecording unit is recorded, as one and the same title untilpredetermined condition is satisfied. The predetermined condition forclosing the title is, for example, that the disk is ejected, the numberof chapters of the title reaches ninety-nine, the number of cells of thetitle reaches ninety-nine, the transition from video recording tostill-image recording occurs, etc.

In the case where the data that is recorded on a chapter-by-chapterbasis in the above-described manner is reproduced, a display image isinterrupted for a moment due to a minute gap that occurs betweenchapters. In average, the recording unit of the camcorder is about froma little over ten seconds to several tens of seconds. It is notdesirable that a reproduced image is interrupted for each recordingunit.

Therefore, there have been proposed technologies for achieving seamlessconnection that allows connecting video streams to one another withoutno interruptions to be seen therebetween (For example, refer to JapaneseUnexamined Patent Application Publication No. 11-155131 (FIG. 25).).

According to the above-described known technology, where partialsections of a video object are coupled to one another, a VOBU includingpicture data at the end of the partial section and a VOBU includingpicture data at the leading end of the same are read from an opticaldisk, and the VOBUs are divided into a plurality of audio packs and aplurality of video packs. Then, the video packs are re-encoded and partof the plurality of audio packs is multiplexed into a subsequentsection. That is to say, an output stream must be remultiplexed.

On the other hand, the MPEG-2 (Moving Picture Experts Group phase 2)standard is used, in the case where video encoding is performed forperforming recording compliant with the DVD-Video standard. According tothe MPEG-2 standard, however, a virtual buffer referred to as a VBV(refer to Video Buffering Verifier: ISO13818-2 Annex C) is expected tobe provided between an encoder and a decoder, and encoding must beperformed so that no errors occur in the VBV buffer. When trying toachieve the seamless connection between video streams that areseparately encoded, the data of a following chapter is transmitted tothe VBV buffer without consideration of the occupied amount of apreceding chapter of the VBV buffer. Subsequently, an error may occur inthe VBV buffer.

Accordingly, the present invention provides a video-encoding device forachieving seamless connection between chapters without causing an errorin the VBV buffer.

DISCLOSURE OF INVENTION

For solving the above-described problems, a video-encoding device of thepresent invention (1) is a video-encoding device for encoding videosignals and exerts control over the encoding according to an occupiedamount of a virtual buffer, the occupied amount being determined basedon the amount of codes generated through the encoding and the amount ofcodes transferred to an output destination. The video-encoding devicecomprises recording-mode determination means for determining whether ornot seamless connection between a preceding chapter and the followingchapter that are included in the video signals is feasible and settingan initial value of the occupied amount of the virtual buffer based onthe determination result, occupied-amount update means for updating theoccupied amount of the virtual buffer every time the encoding isperformed, optimum-occupied-amount calculation means for calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer, target-code-amount calculation means forcalculating a predetermined target-code amount based on the videosignals of the following chapter, target-code-amount adjustment meansfor adjusting the target code amount so that the sum total of theoccupied amount of the virtual buffer and the target code amount doesnot exceed the optimum occupied amount, and encoding means forperforming the encoding based on the adjusted target code amount.Accordingly, the initial value of the occupied amount of the virtualbuffer is set, the target code amount is calculated based on theoccupied amount, and the encoding is performed. Therefore, the seamlessconnection between chapters can be achieved without causing an error inthe virtual buffer.

Further, in a video-encoding device of the present invention (2), thevideo-encoding device being provided according to the video-encodingdevice of the present invention (1), the recording-mode determinationmeans determines an occupied amount of the virtual buffer immediatelybefore the video signals of the following chapter are transferred to thevirtual buffer to be an initial value of the occupied amount of thevirtual buffer, where the seamless connection is feasible, and sets theinitial value of the occupied amount of the virtual buffer to zero,where the seamless connection is infeasible. Subsequently, where theinitial value of the occupied amount of the virtual buffer for thefollowing chapter is set, the state of the occupied amount due to thepreceding chapter of the virtual buffer is taken over.

Further, in a video-encoding device of the present invention (3), thevideo-encoding device being provided according to the video-encodingdevice of the present invention (2), the occupied-amount update meansdetermines a predetermined value that is obtained by subtracting thecode-for-transfer amount from the occupied amount and adding thegenerated-code amount to the occupied amount and that is not larger thanthe maximum value of the virtual buffer to be a new occupied amount,where the occupied amount is larger than the code-for-transfer amount,and determines the generated-code amount to be the new occupied amount,where the occupied amount is equivalent to the code-for-transfer amountor less. Accordingly, information about the occupied amount of thevirtual buffer is updated.

Further, in a video-encoding device of the present invention (4), thevideo-encoding device being provided according to the video-encodingdevice of the present invention (2), the optimum-occupied-amountcalculation means calculates a predetermined value that is equivalent toand/or as large as the updated occupied amount of the virtual buffer, asthe optimum occupied amount. Subsequently, the occupied amount of thevirtual buffer can be reflected in the bit rate, so that steep imagedeterioration can be reduced.

Further, a video-encoding control device of the present invention (5) isa video-encoding control device for exerting control over encoding basedon an occupied amount of a virtual buffer, the occupied amount beingdetermined based on the amount of codes generated at the time wherevideo signals are encoded and the amount of codes transferred to anoutput destination. The video-encoding control device comprisesrecording-mode determination means for determining whether or notseamless connection between a preceding chapter and the followingchapter that are included in the video signals is feasible and settingan initial value of the occupied amount of the virtual buffer based onthe determination result, occupied-amount update means for updating theoccupied amount of the virtual buffer every time the encoding isperformed, optimum-occupied-amount calculation means for calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer, target-code-amount calculation means forcalculating a predetermined target-code amount based on the videosignals of the following chapter, and target-code-amount adjustmentmeans for adjusting the target code amount so that the sum total of theoccupied amount of the virtual buffer and the target code amount doesnot exceed the optimum occupied amount and using the adjusted targetcode amount for the encoding. Accordingly, the initial value of theoccupied amount of the virtual buffer is set and the target code amountis calculated based on the occupied amount, so that the encoding iscontrolled. Therefore, the seamless connection between chapters can beachieved without causing an error in the virtual buffer.

Further, in a video-encoding control device of the present invention(6), the video-encoding control device being provided according to thevideo-encoding control device according to the present invention (2),the recording-mode determination means determines an occupied amount ofthe virtual buffer immediately before the video signals of the followingchapter are transferred to the virtual buffer to be an initial value ofthe occupied amount of the virtual buffer, where the seamless connectionis feasible, and sets the initial value of the occupied amount of thevirtual buffer to zero, where the seamless connection is infeasible.Subsequently, where the initial value of the occupied amount of thevirtual buffer for the following chapter is set, the state of theoccupied amount due to the preceding chapter of the virtual buffer istaken over.

Further, a video-encoding control method of the present invention (7) isa video-encoding control method for exerting control over encoding basedon an occupied amount of a virtual buffer, the occupied amount beingdetermined based on the amount of codes generated at the time wherevideo signals are encoded and the amount of codes transferred to anoutput destination. The video-encoding control method comprises a stepfor determining whether or not seamless connection between a precedingchapter and the following chapter that are included in the video signalsis feasible, a step for setting an initial value of the occupied amountof the virtual buffer based on the determination result, a step forupdating the occupied amount of the virtual buffer every time theencoding is performed, a step for calculating a predetermined optimumoccupied amount based on the updated occupied amount of the virtualbuffer, a step for calculating a predetermined target-code amount basedon the video signals of the following chapter, and a step for adjustingthe target code amount so that the sum total of the occupied amount ofthe virtual buffer and the target code amount does not exceed theoptimum occupied amount and using the adjusted target code amount forthe encoding. Accordingly, the initial value of the occupied amount ofthe virtual buffer is set and the target code amount is calculated basedon the occupied amount, so that the encoding is controlled. Therefore,the seamless connection between chapters can be achieved without causingan error in the virtual buffer.

A video-encoding control method of the present invention (8) is avideo-encoding control method for exerting control over encoding basedon an occupied amount of a virtual buffer, the occupied amount beingdetermined based on the amount of codes generated at the time wherevideo signals are encoded and the amount of codes transferred to anoutput destination. The video-encoding control method comprises a stepfor determining whether or not seamless connection between a precedingchapter and the following chapter that are included in the video signalsis feasible, a step for determining an occupied amount of the virtualbuffer immediately before the video signals of the following chapter aretransferred to the virtual buffer to be an initial value of the occupiedamount of the virtual buffer, where it is determined that the seamlessconnection is feasible based on the determination result, and settingthe initial value of the occupied amount of the virtual buffer to zero,where it is determined that the seamless connection is infeasible, astep for updating the occupied amount of the virtual buffer every timethe encoding is performed, a step for calculating a predeterminedoptimum occupied amount based on the updated occupied amount of thevirtual buffer, a step for calculating a predetermined target-codeamount based on the video signals of the following chapter, and a stepfor adjusting the target code amount so that the sum total of theoccupied amount of the virtual buffer and the target code amount doesnot exceed the optimum occupied amount and using the adjusted targetcode amount for the encoding. Subsequently, where the initial value ofthe occupied amount of the virtual buffer for the following chapter isset, the state of the occupied amount due to the preceding chapter ofthe virtual buffer is taken over.

Further, a program of the present invention (9) is a program forexerting control over encoding based on an occupied amount of a virtualbuffer, the occupied amount being determined based on the amount ofcodes generated at the time where video signals are encoded and theamount of codes transferred to an output destination. The program makesa computer execute a step for determining whether or not seamlessconnection between a preceding chapter and the following chapter thatare included in the video signals is feasible, a step for determining aninitial value of the occupied amount of the virtual buffer based on thedetermination result, a step for updating the occupied amount of thevirtual buffer every time the encoding is performed, a step forcalculating a predetermined optimum occupied amount based on the updatedoccupied amount of the virtual buffer, a step for calculating apredetermined target-code amount based on the video signals of thefollowing chapter, and a step for adjusting the target code amount sothat the sum total of the occupied amount of the virtual buffer and thetarget code amount does not exceed the optimum occupied amount and usingthe adjusted target code amount for the encoding. Accordingly, theinitial value of the occupied amount of the virtual buffer is set andthe target code amount is calculated based on the occupied amount, sothat the encoding is controlled. Therefore, the seamless connectionbetween chapters can be achieved without causing an error in the virtualbuffer.

A program of the present invention (10) is a program for exertingcontrol over encoding based on an occupied amount of a virtual buffer,the occupied amount being determined based on the amount of codesgenerated at the time where video signals are encoded and the amount ofcodes transferred to an output destination. The program makes a computerexecute a step for determining whether or not seamless connectionbetween a preceding chapter and the following chapter that are includedin the video signals is feasible, a step for determining an occupiedamount of the virtual buffer immediately before the video signals of thefollowing chapter are transferred to the virtual buffer to be an initialvalue of the occupied amount of the virtual buffer, where it isdetermined that the seamless connection is feasible based on thedetermination result, and setting the initial value of the occupiedamount of the virtual buffer to zero, where it is determined that theseamless connection is infeasible, a step for updating the occupiedamount of the virtual buffer every time the encoding is performed, astep for calculating a predetermined optimum occupied amount based onthe updated occupied amount of the virtual buffer, a step forcalculating a predetermined target-code amount based on the videosignals of the following chapter, and a step for adjusting the targetcode amount so that the sum total of the occupied amount of the virtualbuffer and the target code amount does not exceed the optimum occupiedamount and using the adjusted target code amount for the encoding.Subsequently, where the initial value of the occupied amount of thevirtual buffer for the following chapter is set, the state of theoccupied amount due to the preceding chapter of the virtual buffer istaken over.

The present invention has a good effect of achieving seamless connectionbetween chapters without causing an error in a VBV buffer.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an example configuration of a video-encoding deviceaccording to an embodiment of the present invention.

FIG. 2 shows an example configuration of a video encoder 100 accordingto the embodiment of the present invention.

FIGS. 3A and 3B show models of VBV buffers compliant with the MPEG-2standard.

FIG. 4 shows an example transition of the occupied amount of a VBVbuffer 701 on the encoder side.

FIGS. 5A and 5B show example transitions of the occupied amount of a VBVbuffer 709 on the decoder side.

FIG. 6 shows an example functional configuration of a processor 510 ofan encoding-control unit 500 according to the embodiment of the presentinvention.

FIG. 7 shows an example function VBV of the present invention.

FIG. 8 is a flowchart illustrating example processing performed by thevideo-encoding device according to the embodiment of the presentinvention.

FIG. 9 is a flowchart showing example processing performed for exertingcontrol over the VBV buffer according to the embodiment of the presentinvention.

FIG. 10 is a flowchart illustrating example processing performed forupdating information about the occupied amount of the VBV bufferaccording to the embodiment of the present invention.

BEST MODE FOR CARRYING OUT THE INVENTION

Next, an embodiment of the present invention will be described in detailwith reference to drawings.

FIG. 1 shows an example configuration of a video-encoding deviceaccording to an embodiment of the present invention. The video-encodingdevice includes a video encoder 100 for encoding a video signal, anaudio encoder 200 for encoding an audio signal, a multiplexer 300 formultiplexing outputs of the video encoder 100 and the audio encoder 200,a medium-recording unit 400 for recording stream data multiplexed by themultiplexer 300 onto a recording medium 490, and an encoding-controlunit 500 for controlling encoding performed by the video encoder 100.

The encoding-control unit 500 includes a processor 510, a ROM 520, a RAM530, an input-and-output interface 540, and a bus 550 for connecting theabove-described units to one another. The processor 510 receives agenerated-code amount or the amount of data encoded by the video encoder100 via a signal line 179, determines a quantization index conforming toa target-code amount or the amount of target data for encoding the nextpicture, and externally transmits the quantization index through asignal line 159. The ROM 520 is a memory for holding programs, variousparameters, and so forth that are executed by the processor 510 andachieved by an EPROM including a flush memory or the like, for example.The RAM is a memory for holding work data or the like, where the workdata is necessary when the processor 510 executes the program, andachieved by an SRAM, a DRAM, etc., for example. The input-and-outputinterface 540 exchanges data between itself and the outside, and is usedfor updating the program in the ROM 520, for example.

FIG. 2 shows an example configuration of the video encoder 100 accordingto the embodiment of the present invention. This video encoder 100encodes a video signal transmitted thereto via a signal line 101 andexternally transmits the encoded video signal via a signal line 199. Thevideo encoder 100 includes a rearrangement circuit 111, ascan-conversion circuit 112, a motion-detection circuit 121, amotion-compensation circuit 122, a subtractor 131, an adder 132, a DCTcircuit 141, an inverse-DCT circuit 142, a quantization circuit 151, adequantization circuit 152, an encoder 161, and a buffer memory 171.

The rearrangement circuit 111 rearranges each of pictures of videosignals transmitted thereto via the signal line 101 according to theencoding order and transmits the rearranged pictures to thescan-conversion circuit 112. The scan-conversion circuit 112 determineswhether the data of the transmitted pictures has a frame structure or afield structure and performs scan conversion compliant with thedetermination result for the data of the transmitted pictures. Then, thescan-conversion circuit 112 converts the data into macro-block data andexternally transmits the macro-block data to each of themotion-detection circuit 121 and the subtractor 131.

The motion-detection circuit 121 detects a motion vector based on thedata transmitted from the scan-conversion circuit 112 and transmits themotion vector to the motion-compensation circuit 122. Themotion-compensation circuit 122 reads image data conforming to themacro-block data transmitted to the subtractor 131 of image data thatwas stored in the motion-compensation circuit 122 in advance based onthe motion vector transmitted from the motion-detection circuit 121.Then, the motion-compensation circuit 122 transmits the read image datato each of the subtractor 131 and the adder 132, as predicted-imagedata.

Where the macro-block data transmitted from the scan-conversion circuit112 is an I picture, the subtractor 131 transmits the macro-block datain its original format to the DCT circuit 141. Where the macro-blockdata is a P picture, or a B picture, the subtractor 131 transmits dataobtained by subtracting the predicted-image data transmitted from themotion-compensation circuit 122 from the macro-block data to the DCTcircuit 141.

The DCT circuit 141 performs DCT (Discrete Consign Transform) processingfor the data transmitted from the subtractor 131 and converts the datainto a DCT coefficient. The quantization circuit 151 quantizes the DCTcoefficient transmitted from the DCT circuit 141 based on thequantization index transmitted from the encoding-control unit 500 viathe signal line 159 and transmits the quantized DCT coefficient to theencoder 161 and the dequantization circuit 152. The encoder 161 convertsthe quantized data into a variable-length code and stores thevariable-length code in the buffer memory 171. The buffer memory 171converts the stored variable-length code into data in pictures andexternally transmits the data to the signal line 199, as bit-streamdata. Further, the buffer memory 171 transmits the amount of generatedvariable-length codes of an entire picture to the encoding-control unit500 via the signal line 179, as a generated-code amount.

The dequantization circuit 152 dequantizes the quantized datatransmitted from the quantization circuit 151. The inverse DCT circuit142 performs inverse DCT processing for the data dequantized by thedequantization circuit 152 and transmits the data to the adder 132. Theadder 132 adds the data transmitted from the inverse DCT circuit 142 tothe predicted-image data transmitted from the motion-compensationcircuit 122 so that the original image is reconstructed, and transmitsthe original image data to the motion-compensation circuit 122, so as togenerate predicted-image data corresponding to the macro-block imagedata that will be encoded next time or later.

FIGS. 3A and 3B show models of VBV buffers under the MPEG-2 standard.Under the MPEG-2 standard, virtual buffers referred to as VBV buffersare envisioned between the encoder and a decoder for transmitting anddecoding obtained bit-stream data in an appropriate manner, and encodingis performed so that the VBV buffers do not overflow. The differencebetween the amount of codes generated by the encoder and the amount ofcodes transferred to an output destination corresponds to the amount ofdata (This amount is referred to as an “occupied amount”.) existing inthe VBV buffers. The maximum amount of the VBV buffers is defined as 224KB. However, the VBV buffers are provided virtually and do notnecessarily exist.

When the VBV buffers are viewed from the encoder-side, a VBV buffer 701is connected to the output-side of the video encoder 100 and data isinstantaneously transferred from the video encoder 100 to the VBV buffer701 in theory, as shown in FIG. 3A. Then, where data exists in the VBVbuffer 701, an output signal from the VBV buffer 701 is transferred attransfer speed Rmax. Where no data exists in the VBV buffer 701, theoutput signal from the VBV buffer 701 is transferred at transfer speed0. Subsequently, the occupied amount of the VBV buffer 701 is obtainedand operations of the video encoder 100 are controlled so that theoccupied amount does not exceed the maximum amount of the VBV buffer 701(so that the VBV buffer 701 does not overflow).

On the other hand, when the VBV buffers are viewed from the decoderside, a VBV buffer 709 is connected to the input side of a video decoder900 and data is instantaneously transferred from the VBV buffer 709 tothe video decoder 900 in theory, as shown in FIG. 3B. Then, an inputsignal to the VBV buffer 709 is transferred at the transfer speed Rmax,or the transfer speed 0. In that case, the transfer is performed so thatan occupied amount of the VBV buffer 709 does not exceed the maximumamount thereof and the input signal must be transferred, so as to be intime for decoding performed by the video decoder 900. If the inputsignal is late for the decode-timing of the video decoder 900, underflowoccurs in the VBV buffer 709.

FIG. 4 shows an example transition of the occupied amount of the VBVbuffer 701 on the encoder side. The vertical axis represents theoccupied amount of the VBV buffer and the lateral axis represents time,respectively. The occupied amount along the vertical axis is shown in adownward direction, which means that the occupied amount increases as itfalls. Incidentally, the maximum amount of the VBV buffer 701 is definedas 224 KB.

Incidentally, here, the sign T represents the picture-generation cycle,that is, the reciprocal of the frame rate. Further, the sign n is aninteger representing the number of a desired picture. Further, the signPX represents the actual amount of generated codes of the X-th pictureand the sign BX represents the occupied amount of the VBV bufferimmediately before the X-th picture is encoded.

The video encoder 100 encodes video signals transmitted thereto in orderof the picture number. Immediately after the 0-th picture is encoded(time 0), generated-code amount P0 is instantaneously transferred to theVBV buffer 701, and the occupied amount of the VBV buffer is representedby B0+P0. Subsequently, until the time when encoding of the next orfirst picture is finished, codes are transmitted from the VBV buffer 701at the transfer speed Rmax, whereby the occupied amount of the VBVbuffer 701 decreases over the course of time.

Just prior to the time when the first picture is encoded (time T), theoccupied amount of the VBV buffer 701 becomes B1 and the first picturewith generated-code amount P1 is instantaneously transferred to the VBVbuffer 701. As a result, at the time T, the occupied amount of the VBVbuffer 701 is represented by B1+P1.

After that, data is further transferred from the VBV buffer 701 and thecodes of encoded pictures are further stored in the VBV buffer 701 inthe above-described manner. Just prior to the time when the n-th pictureis encoded (time n×T), the occupied amount of the VBV buffer isrepresented by the sign Bn (=Bn−1+Pn−1) and the n-th picture with codeamount Pn is instantaneously transferred to the VBV buffer. As a result,at the time n×T, the occupied amount of the VBV buffer 701 isrepresented by Bn+Pn.

Here, when the amount of externally transmitted codes exceeds the amountof internally transmitted codes, the occupied amount of the VBV buffer701 becomes 0, as indicated at time Tx, and the VBV buffer 701 stopstransmitting data. When the data is stored in a DVD, the occurrence ofunderflow of the VBV buffer 701 on the encoder side is tolerable.However, even though the data is stored in the DVD, overflow of the VBVbuffer 701 is not tolerable. Therefore, the video encoder 100 must havecontrol over the VBV buffer 701 so that the VBV buffer 701 does notoverflow.

FIGS. 5A and 5B show example transitions of the occupied amount of theVBV buffer 709 on the decoder side. The vertical axis represents theoccupied amount of the VBV buffer and the lateral axis represents time,respectively. In contrast to FIG. 4, the occupied amount along thevertical axis is shown in an upward direction, which means that theoccupied amount increases as it rises.

Where a video stream exists in a bit stream, a code is stored in the VBVbuffer 709 at the transfer speed Rmax. Where no video stream exists inthe bit stream, no codes are stored in the VBV buffer 709. Further, thecode instantaneously flows from the VBV buffer 709 to the video decoder900 at the time when decoding of each of the pictures is started.

Where chapters are not seamlessly connected to each other, as shown inFIG. 5A, a decoded image has a gap corresponding to an interval betweena preceding chapter and the following chapter. In that case, after theoccupied amount of the VBV buffer 709 due to the generated codes of thepreceding chapter becomes zero, codes generated by the following chapterflow in. Therefore, there is no need to make allowance for interferenceof chapters, where the interference is caused by the VBV buffer 709.

However, where the chapters are seamlessly connected to each other, asshown in FIG. 5B, generated codes of the following chapter flow inbefore the occupied amount of the VBV buffer 709 due to the precedingchapter becomes zero. Therefore, the occupied amount of the VBV buffer709 due to the preceding chapter should be taken over for calculatingthe initial value of the VBV buffer 709. If the generated codes of thefollowing chapter start flowing in at the time where much of theoccupied amount of the VBV buffer 709 due to the preceding chapterremains, the VBV buffer 709 may overflow.

On the other hand, if a code-inflow for decoding is started at the timewhen the amount of code data stored in the VBV buffer 709 isinsufficient, the VBV buffer 709 may underflow. For example, where anecessary amount of code data for decoding a first picture (I2) of thefollowing chapter is drawn instantaneously and if the amount of codedata stored in the VBV buffer 709 is insufficient, the code datanecessary for the decoding cannot be obtained. Therefore, the seamlessconnection cannot be achieved. For storing the sufficient amount of codedata in advance, transfer of a bit stream of the following chaptershould be started as soon as possible. However, there is a limit to howsoon the transfer of the following chapter can be started, since thetransfer of the following chapter has to be started after transfer ofthe preceding chapter is finished.

Therefore, according to the embodiment of the present invention,encoding is performed while restrictions are put on the amount ofgenerated code data of the following chapter, as below, so as to allowseamless connection between chapters even though requirements for theVBV buffers are met. Further, since there is a close connection betweenthe above-described VBV buffers 701 and 709, the VBV buffer 701 will bedescribed, as a premise.

FIG. 6 illustrates an example functional configuration of a processor510 of the encoding-control unit 500 according to the embodiment of thepresent invention. In this example functional configuration, arecording-mode determination unit 511, an occupied-amount update unit512, an optimum occupied-amount calculation unit 513, atarget-code-amount calculation unit 514, a target-code-amount adjustmentunit 515, and a quantization-index determination unit 516 are provided.Further, even though this example is given on the assumption that theprocessor 510 achieves each of functions according to a program held inthe ROM 520, those functions may be achieved through hardware.

The recording-mode determination unit 511 determines whether or not theseamless connection between the chapters can be achieved. For achievingthe seamless connection, the following chapter subjected to the seamlessconnection should not be the first chapter of a title to which thefollowing chapter belongs, a time period of reproducing the final VOB ofthe preceding chapter should not be less than 1.5 sec, and a seek timeperiod determined due to the on-medium layout should fall within anallowable range, for example. The presence or absence of the seamlessconnection determined by the recording-mode determination unit 511affects a seamless playback flag in a C_PBIT (Cell PlayBack InformationTable) of PGCI (ProGram Chain Information) of VTSI (Video Title SetInformation) in a data-storage area of the DVD. That is to say, wherethe seamless connection is performed, the seamless playback flag of thefollowing chapter is set to ON and where the seamless connection is notperformed, the seamless playback flag of the following chapter is set toOFF.

Further, where it is determined that the seamless connection isfeasible, the recording-mode determination unit 511 determines theimmediately preceding occupied amount of the VBV buffer held in the RAM530 (or the ROM 520) to be the initial value of the VBV buffer. On theother hand, where it is determined that the seamless connection is notfeasible, the initial value of the VBV buffer is set to zero. Theinitial value of the VBV buffer corresponds to an occupied amount “B0”shown in FIG. 4. The initial value of the VBV buffer is set in theabove-described manner and transmitted to the occupied-amount updateunit 512.

The occupied-amount update unit 512 updates the occupied amount of theVBV buffer based on the amount of generated code data transmitted fromthe buffer memory 171 of the video encoder 100. For example, where“B0+P0” shown in FIG. 4 is determined to be the immediately previoustiming, the amount of code data for transfer up to “B1” is subtractedfrom “B0+P0”. Further, the amount of generated code data “P1” is addedto “B0+P0”.

In that case, if the assumption is made that the transfer speed Rmax is9.3 Mbps and the NTSC (National Television Standards Committee) methodis determined to be a screen method, the frame frequency of the NTSC isrepresented, as:(1000/1001×30)29.97 Hz,whereby the amount of code data transferred per cycle is represented,as:9.3 Mbps/29.97 Hz=310.31 K bits.

Where the amount of code data for transfer is subtracted and the VBVbuffer is emptied, as indicated at Tx shown in FIG. 4, the occupiedamount at that point becomes zero, since further data transfer isinfeasible. Then, a value obtained by adding the generated-code-dataamount to the occupied amount becomes a new occupied amount. Theoccupied amount updated in the above-described manner is held in the RAM530 (or the ROM 520) and transmitted to the optimum-occupied-amountcalculation unit 513.

The optimum-occupied-amount calculation unit 513 calculates the optimumoccupied amount of the VBV buffer at the time when the next picture isencoded. The optimum occupied amount is an index of an ideal occupiedamount of the VBV buffer after the next-picture encoding is finished. Ifthe occupied amount of the VBV buffer exceeds the value, the possibilitythat the VBV buffer overflows significantly increases. It was shown byexperiment data that the optimum occupied amount can be calculated by afunction shown as: By=VBV (Bx). By using the function VBV, the occupiedamount of the VBV buffer can be quickly reflected in the bit rate, sothat steep image deterioration can be reduced. Here, the sign Bxrepresents the amount of using VBV buffer before the x-th picture isencoded and the sign By represents the optimum occupied amount of theVBV buffer after the x-th picture is encoded.

Characteristic 1: By=VBV (Bx) represents a monotonously increasingfunction for Bx in Bx section [0, Bmax].

Characteristic 2: function {By=Bx} and function {By=VBV (Bx)−(Rmax×T)}cross each other at Bx=Bth (where 0<Bth<Bmax) in the Bx section [0,Bmax].

Characteristic 3: Where an expression Bx≦Bth holds, an expression{VBV(Bx)−(Rmax×T)}≧Bx holds, and where an expression Bx>Bth holds, anexpression {VBV(Bx)−(Rmax×T)}<Bx holds.

FIG. 7 shows an example VBV function having the above-described threecharacteristics. In the case of the VBV function, the value By remainsconstant at a predetermined value (a value of Bth or more) in a sectionwhere the value BX is [0, Bth]. Further, the value By graduallyincreases at the increase rate of less than one in a section where thevalue BX is [Bth, Bmax].

In FIG. 6, the optimum-occupied-amount calculation unit 513 transmitsthe optimum occupied amount obtained in the above-described manner ofthe VBV buffer to the target-code-amount adjustment unit 515.

The target-code-amount calculation unit 514 calculates a target-codeamount based on a video signal of the following chapter that will besubjected to the seamless connection. Various types of models have beenproposed for calculating the target code amount. Here, the known TM5method is used, as an example. The TM5 method has been proposed, as amodel for controlling the code amount of the MPEG-2 (refer to ISO/IECJTC1/SC29/WG11, MPEG93/457, “Test Model 5,” 1993.), so as to determineallocation of the code-data amount according to each of picture types.

The target-code-amount adjustment unit 515 determines whether or not thevalue obtained by adding the target code amount to the current occupiedamount exceeds the optimum occupied amount with reference to the targetcode amount calculated by the target-code-amount calculation unit 514and the optimum occupied amount calculated by theoptimum-occupied-amount calculation unit 513. If the value exceeds theoptimum occupied amount, the target-code-amount adjustment unit 515adjusts the target-code amount so that a value obtained by subtractingthe current occupied amount from the optimum occupied amount becomes thetarget-code amount. The target-code amount adjusted in theabove-described manner is transmitted to the quantization-indexdetermination unit 516.

The quantization-index determination unit 516 determines a quantizationindex corresponding to a quantization characteristic value of thequantization circuit 151, so that the generated-code amount of the videoencoder 100 becomes the target-code amount transmitted from thetarget-code-amount adjustment unit 515. The quantization index istransmitted to the quantization circuit 151 via the signal line 159.

Next, operations of the video-encoding device according to theembodiment of the present invention will be described with reference tothe attached drawings.

FIG. 8 is a flowchart illustrating example processing performed by thevideo-encoding device according to the embodiment of the presentinvention. Prior to encoding the following chapter, the recording-modedetermination unit 511 determines whether or not seamless connectionshould be performed, as a recording mode (step S901). Where the seamlessconnection is performed (step S902), the immediately previous occupiedamount of the VBV buffer held in the RAM 530 (or the ROM 520) is set, asthe initial value of the VBV buffer (step S903). On the other hand,where the seamless connection is not performed (step S902), the initialvalue of the VBV buffer is set to zero (step S904).

After the preparations are made by the recording-mode determination unit511, the video signals of the following chapter are encoded by as muchas a single picture (frame) at a time by the video encoder 100 (stepS905). Then, every time the video signals are encoded by as much as asingle picture, control over the VBV buffer is effected (step S906). Theabove-described steps S905 and S906 are repeated until encoding for theentire pictures (frames) of the following chapter is finished (stepS907).

FIG. 9 is a flowchart showing example processing performed for exertingcontrol over the VBV buffer according to the embodiment of the presentinvention (step S906). As is clear from FIG. 8, the control over the VBVbuffer is effected every time encoding is performed by as much as asingle picture (frame).

When the encoding for a single picture is finished, first, informationabout the occupied amount of the VBV buffer is updated by theoccupied-amount update unit 512 (step S911). Subsequently, the occupiedamount of the VBV buffer immediately after the encoding is obtained. Thedetails of the above-described processing will be described withreference to FIG. 10.

Then, the optimum-occupied-amount calculation unit 513 calculates theoptimum occupied amount of the VBV buffer after the next encoding (stepS912). The optimum occupied amount can be calculated by using theabove-described VBV function, for example. Further, thetarget-code-amount calculation unit 514 calculates a target code amountfor the next encoding (step S913). The target code amount can becalculated by using the known TM5 method, for example.

Then, the target-code-amount adjustment unit 515 determines whether ornot a value obtained by adding the current occupied amount of the VBVbuffer, where the current occupied amount is obtained, at step S911, tothe target code amount calculated, at step S913 exceeds the optimumoccupied amount calculated, at step S912 (step S914). When the valueexceeds the optimum occupied amount, the target-code-amount adjustmentunit 515 adjusts the value so that a value obtained by subtracting thecurrent occupied amount from the optimum occupied amount becomes thetarget code amount (step S915).

The quantization-index determination unit 516 determines a quantizationindex based on the target code amount adjusted in the above-describedmanner (step S916). The quantization index is transmitted to thequantization circuit 151 of the video encoder 100.

FIG. 10 is a flowchart illustrating example processing performed forupdating information about the occupied amount of the VBV bufferaccording to the embodiment of the present invention (step S911). First,a code-for-transfer amount corresponding to a single cycle is subtractedfrom the immediately previous occupied amount of the VBV buffer. At thattime, the occupied amount before the subtraction and thecode-for-transfer amount corresponding to the single cycle (310.31 Kbits in the above-described example) are compared to each other (stepS921). When the occupied amount before the subtraction is larger, thesubtraction result becomes a new occupied amount (step S922). Otherwise,underflow occurs in the VBV buffer, so that the new occupied amountbecomes zero (step S923).

Then, a generated-code amount of the video encoder 100 is added to thenew occupied amount (step S924). Where the occupied amount after theaddition exceeds the maximum amount of the VBV buffer (step S925), theVBV buffer overflows, whereby the new occupied amount becomes themaximum amount of the VBV buffer (step S926).

Thus, according to the embodiment of the present invention, therecording-mode determination unit 511 determines whether or not theseamless connection between chapters should be performed. The initialvalue of the VBV buffer is determined in advance according to thedetermination result, and the encoding-control unit 500 controls thegenerated-code amount of the following chapter subjected to the seamlessconnection. Subsequently, it becomes possible to achieve seamlessconnection that causes no errors in the VBV buffer.

Incidentally, the embodiment of the present invention is an exampleembodying the present invention. Although the embodiment corresponds tospecific items that fall within the scope of claims of the presentinvention, as shown below, the present invention is not limited to theembodiment but can be modified in various ways without leaving thespirit of the present invention.

That is to say, in the present invention (1), a virtual buffercorresponds to the VBV buffer 701, for example. Further, recording-modedetermination means corresponds to the recording-mode determination unit511, for example. Further, occupied-amount update means corresponds tothe occupied-amount update unit 512, for example. Further,optimum-occupied-amount calculation means corresponds to theoptimum-occupied-amount calculation unit 513, for example. Further,target-code-amount calculation means corresponds to thetarget-code-amount calculation unit 514, for example. Further,target-code-amount adjustment means corresponds to thetarget-code-amount adjustment unit 515, for example. Further, encodingmeans corresponds to the video encoder 100, for example.

Further, in the present invention (5), a virtual buffer corresponds tothe VBV buffer 701, for example. Further, recording-mode determinationmeans corresponds to the recording-mode determination unit 511, forexample. Further, occupied-amount update means corresponds to theoccupied-amount update unit 512, for example. Further,optimum-occupied-amount calculation means corresponds to theoptimum-occupied-amount calculation unit 513, for example. Further,target-code-amount calculation means corresponds to thetarget-code-amount calculation unit 514, for example.

Further, in the present invention (7), or the present invention (9), avirtual buffer corresponds to the VBV buffer 701, for example. Further,the step for determining whether or not seamless connection between apreceding chapter and the following chapter that are included in videosignals is feasible corresponds to step S901, for example. Further, thestep for setting the initial value of an occupied amount of the virtualbuffer according to the determination result corresponds to steps S902to S904, for example. Further, the step for updating the occupied amountof the virtual buffer every time the encoding is performed correspondsto step S911, for example. Further, the step for calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer corresponds to step S912, for example.Further, the step for calculating a predetermined target code amountbased on the video signals of the following chapter corresponds to stepS913, for example. Further, the step for adjusting the target codeamount so that the sum total of the occupied amount of the virtualbuffer and the target code amount does not exceed the optimum occupiedamount, and using the adjusted target code amount for encodingcorresponds to steps S914 and S915, for example.

Further, in the present invention (8), or the present invention (10), avirtual buffer corresponds to the VBV buffer 701, for example. Further,the step for determining whether or not seamless connection between apreceding chapter and the following chapter that are included in videosignals is feasible corresponds to step S901, for example. Further, thestep for determining an occupied amount of the virtual bufferimmediately before the video signals of the following chapter aretransferred to the virtual buffer to be an initial value of the occupiedamount of the virtual buffer, where it is determined that the seamlessconnection is feasible based on the determination result, and settingthe initial value of the occupied amount of the virtual buffer to zero,where it is determined that the seamless connection is infeasible,corresponds to steps S902 to S904, for example. Further, the step forupdating the occupied amount of the virtual buffer every time theencoding is performed corresponds to step S911, for example. Further,the step for calculating a predetermined optimum occupied amount basedon the updated occupied amount of the virtual buffer corresponds to stepS912, for example. Further, the step for calculating a predeterminedtarget code amount based on the video signals of the following chaptercorresponds to step S913, for example. Further, the step for adjustingthe target code amount so that the sum total of the occupied amount ofthe virtual buffer and the target code amount does not exceed theoptimum occupied amount, and using the adjusted target code amount forencoding corresponds to steps S914 and S915, for example.

Incidentally, processing steps described in the embodiment of thepresent invention may be interpreted, as a method including theabove-described series of steps. Further, the processing steps may beinterpreted, as a program for making a computer execute theabove-described series of steps and/or a recording medium storing theprogram.

INDUSTRIAL APPLICABILITY

For example, the present invention can be used for encoding a videosignal into an MPEG-2 code and writing the MPEG-2 code onto a DVD, forexample.

1. A video-encoding device for encoding video signals and exerts controlover the encoding according to an occupied amount of a virtual buffer,the occupied amount being determined based on the amount of codesgenerated through the encoding and the amount of codes transferred to anoutput destination, the video-encoding device comprising: recording-modedetermination means for determining whether or not seamless connectionbetween a preceding chapter and the following chapter that are includedin the video signals is feasible and setting an initial value of theoccupied amount of the virtual buffer based on the determination result,wherein the recording-mode determination means determines an occupiedamount of the virtual buffer immediately before the video signals of thefollowing chapter are transferred to the virtual buffer to be an initialvalue of the occupied amount of the virtual buffer, where the seamlessconnection is feasible, and sets the initial value of the occupiedamount of the virtual buffer to zero, where the seamless connection isinfeasible; occupied-amount update means for updating the occupiedamount of the virtual buffer every time the encoding is performed,wherein the occupied-amount update means determines a predeterminedvalue that is obtained by subtracting the code-for-transfer amount fromthe occupied amount and adding the generated-code amount to the occupiedamount and that is not larger than the maximum value of the virtualbuffer to be a new occupied amount, where the occupied amount is largerthan the code-for-transfer amount, and determines the generated-codeamount to be the new occupied amount, where the occupied amount isequivalent to the code-for-transfer amount or less;optimum-occupied-amount calculation means for calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer; target-code-amount calculation means forcalculating a predetermined target-code amount based on the videosignals of the following chapter; target-code-amount adjustment meansfor adjusting the target code amount so that the sum total of theoccupied amount of the virtual buffer and the target code amount doesnot exceed the optimum occupied amount; and encoding means forperforming the encoding based on the adjusted target code amount.
 2. Thevideo-encoding device according to claim 1, wherein theoptimum-occupied-amount calculation means calculates a predeterminedvalue that is equivalent to and/or as large as the updated occupiedamount of the virtual buffer, as the optimum occupied amount.
 3. Avideo-encoding control device for exerting control over encoding basedon an occupied amount of a virtual buffer, the occupied amount beingdetermined based on the amount of codes generated at the time wherevideo signals are encoded and the amount of codes transferred to anoutput destination, the video-encoding control device comprising:recording-mode determination means for determining whether or notseamless connection between a preceding chapter and the followingchapter that are included in the video signals is feasible and settingan initial value of the occupied amount of the virtual buffer based onthe determination result, wherein the recording-mode determination meansdetermines an occupied amount of the virtual buffer immediately beforethe video signals of the following chapter are transferred to thevirtual buffer to be an initial value of the occupied amount of thevirtual buffer, where the seamless connection is feasible, and sets theinitial value of the occupied amount of the virtual buffer to zero,where the seamless connection is infeasible; occupied-amount updatemeans for updating the occupied amount of the virtual buffer every timethe encoding is performed, wherein the occupied-amount update meansdetermines a predetermined value that is obtained by subtracting thecode-for-transfer amount from the occupied amount and adding thegenerated-code amount to the occupied amount and that is not larger thanthe maximum value of the virtual buffer to be a new occupied amount,where the occupied amount is larger than the code-for-transfer amount,and determines the generated-code amount to be the new occupied amount,where the occupied amount is equivalent to the code-for-transfer amountor less; optimum-occupied-amount calculation means for calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer; target-code-amount calculation means forcalculating a predetermined target-code amount based on the videosignals of the following chapter; and target-code-amount adjustmentmeans for adjusting the target code amount so that the sum total of theoccupied amount of the virtual buffer and the target code amount doesnot exceed the optimum occupied amount and using the adjusted targetcode amount for the encoding.
 4. The video-encoding control deviceaccording to claim 3, wherein the recording-mode determination meansdetermines an occupied amount of the virtual buffer immediately beforethe video signals of the following chapter are transferred to thevirtual buffer to be an initial value of the occupied amount of thevirtual buffer, where the seamless connection is feasible, and sets theinitial value of the occupied amount of the virtual buffer to zero,where the seamless connection is infeasible.
 5. A computer implementedvideo-encoding control method for exerting control over encoding basedon an occupied amount of a virtual buffer, the occupied amount beingdetermined based on the amount of codes generated at the time wherevideo signals are encoded and the amount of codes transferred to anoutput destination, the video-encoding control method comprising:determining whether or not seamless connection between a precedingchapter and the following chapter that are included in the video signalsis feasible by determining that an occupied amount of the virtual bufferimmediately before the video signals of the following chapter aretransferred to the virtual buffer to be an initial value of the occupiedamount of the virtual buffer, where the seamless connection is feasible,and sets the initial value of the occupied amount of the virtual bufferto zero, where the seamless connection is infeasible; setting an initialvalue of the occupied amount of the virtual buffer based on thedetermination result; updating the occupied amount of the virtual bufferevery time the encoding is performed by updating a predetermined valuethat is obtained by subtracting the code-for-transfer amount from theoccupied amount and adding the generated-code amount to the occupiedamount and that is not larger than the maximum value of the virtualbuffer to be a new occupied amount, where the occupied amount is largerthan the code-for-transfer amount, and determines the generated-codeamount to be the new occupied amount, where the occupied amount isequivalent to the code-for-transfer amount or less; calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer; calculating a predetermined target-codeamount based on the video signals of the following chapter; andadjusting the target code amount so that the sum total of the occupiedamount of the virtual buffer and the target code amount does not exceedthe optimum occupied amount and using the adjusted target code amountfor the encoding.
 6. A computer implemented video-encoding controlmethod for exerting control over encoding based on an occupied amount ofa virtual buffer, the occupied amount being determined based on theamount of codes generated at the time where video signals are encodedand the amount of codes transferred to an output destination, thevideo-encoding control method comprising: determining whether or notseamless connection between a preceding chapter and the followingchapter that are included in the video signals is feasible; determiningan occupied amount of the virtual buffer immediately before the videosignals of the following chapter are transferred to the virtual bufferto be an initial value of the occupied amount of the virtual buffer,where it is determined that the seamless connection is feasible based onthe determination result, and setting the initial value of the occupiedamount of the virtual buffer to zero, where it is determined that theseamless connection is infeasible; updating the occupied amount of thevirtual buffer every time the encoding is performed by updating apredetermined value that is obtained by subtracting thecode-for-transfer amount from the occupied amount and adding thegenerated-code amount to the occupied amount and that is not larger thanthe maximum value of the virtual buffer to be a new occupied amount,where the occupied amount is larger than the code-for-transfer amount,and determines the generated-code amount to be the new occupied amount,where the occupied amount is equivalent to the code-for-transfer amountor less; calculating a predetermined optimum occupied amount based onthe updated occupied amount of the virtual buffer; calculating apredetermined target-code amount based on the video signals of thefollowing chapter; and adjusting the target code amount so that the sumtotal of the occupied amount of the virtual buffer and the target codeamount does not exceed the optimum occupied amount and using theadjusted target code amount for the encoding.
 7. A computer programproduct comprising a tangible computer readable medium including programcode thereon, for exerting control over encoding based on an occupiedamount of a virtual buffer, the occupied amount being determined basedon the amount of codes generated at the time where video signals areencoded and the amount of codes transferred to an output destination,the program code being executable to perform operations comprising:determining whether or not seamless connection between a precedingchapter and the following chapter that are included in the video signalsis feasible by determining that an occupied amount of the virtual bufferimmediately before the video signals of the following chapter aretransferred to the virtual buffer to be an initial value of the occupiedamount of the virtual buffer, where the seamless connection is feasible,and sets the initial value of the occupied amount of the virtual bufferto zero, where the seamless connection is infeasible; determining aninitial value of the occupied amount of the virtual buffer based on thedetermination result; updating the occupied amount of the virtual bufferevery time the encoding is performed by updating a predetermined valuethat is obtained by subtracting the code-for-transfer amount from theoccupied amount and adding the generated-code amount to the occupiedamount and that is not larger than the maximum value of the virtualbuffer to be a new occupied amount, where the occupied amount is largerthan the code-for-transfer amount, and determines the generated-codeamount to be the new occupied amount, where the occupied amount isequivalent to the code-for-transfer amount or less; calculating apredetermined optimum occupied amount based on the updated occupiedamount of the virtual buffer; calculating a predetermined target-codeamount based on the video signals of the following chapter; andadjusting the target code amount so that the sum total of the occupiedamount of the virtual buffer and the target code amount does not exceedthe optimum occupied amount and using the adjusted target code amountfor the encoding.
 8. A computer program product comprising a tangiblecomputer readable medium including program code thereon, for exertingcontrol over encoding based on an occupied amount of a virtual buffer,the occupied amount being determined based on the amount of codesgenerated at the time where video signals are encoded and the amount ofcodes transferred to an output destination, the program code beingexecutable to perform operations comprising: determining whether or notseamless connection between a preceding chapter and the followingchapter that are included in the video signals is feasible; determiningan occupied amount of the virtual buffer immediately before the videosignals of the following chapter are transferred to the virtual bufferto be an initial value of the occupied amount of the virtual buffer,where it is determined that the seamless connection is feasible based onthe determination result, and setting the initial value of the occupiedamount of the virtual buffer to zero, where it is determined that theseamless connection is infeasible; updating the occupied amount of thevirtual buffer every time the encoding is performed by updating apredetermined value that is obtained by subtracting thecode-for-transfer amount from the occupied amount and adding thegenerated-code amount to the occupied amount and that is not larger thanthe maximum value of the virtual buffer to be a new occupied amount,where the occupied amount is larger than the code-for-transfer amount,and determines the generated-code amount to be the new occupied amount,where the occupied amount is equivalent to the code-for-transfer amountor less; calculating a predetermined optimum occupied amount based onthe updated occupied amount of the virtual buffer; calculating apredetermined target-code amount based on the video signals of thefollowing chapter; and adjusting the target code amount so that the sumtotal of the occupied amount of the virtual buffer and the target codeamount does not exceed the optimum occupied amount and using theadjusted target code amount for the encoding.